Northwoods.GoWPF 2.2.4 Assembly
GraphModelNodeData<NodeKey> Class
Members 

the Type of a value uniquely identifying a node data in the model
A simple representation of node data for GraphModel<NodeType,NodeKey> that supports property change notification, copying, and undo via the INotifyPropertyChanged, ICloneable, and IChangeDataValue interfaces.
Syntax
Type Parameters
NodeKey
the Type of a value uniquely identifying a node data in the model
Remarks

This provides a standard implementation of GraphModel<NodeType,NodeKey> data that represents nodes and includes properties for collections of adjacent node keys, in either direction, and includes properties for specifying the containing subgraph node key and/or the collection of member node keys. You can use this class if you do not already have your own application class holding information about nodes and if you want to inherit from an existing class so that you can just add your own properties. Here's a simple example:

[Serializable] public class MyData : GraphModelNodeData<String> { public MyData() { } public String Name { get { return _Name; } set { if (_Name != value) { String old = _Name; _Name = value; RaisePropertyChanged("Name", old, value); } } } private String _Name; public String Address { get { return _Address; } set { if (_Address != value) { String old = _Address; _Address = value; RaisePropertyChanged("Address", old, value); } } } private String _Address; }

Note that property setters need to raise the model's Changed event, so that the model knows about changes in the data and can then update the diagram. You should call RaisePropertyChanged only when the value has actually changed, and you should pass both the previous and the new values, in order to support undo/redo.

For both Silverlight and WPF you should override the Clone method if the fields contain data that should not be shared between copies. For WPF the properties that you define should also be serializable, in order for the data to be copiable, especially to and from the clipboard.

If you add properties to this node data class, and if you are using the GraphModel<NodeType,NodeKey>.Save<NodeDataType> and GraphModel<NodeType,NodeKey>.Load<NodeDataType> methods, you should override the MakeXElement and LoadFromXElement methods to add new attributes and/or elements as needed,

Normally, each Key should have a unique value within the model. You can maintain that yourself, by setting the Key to unique values before adding the node data to the model's collection of nodes. Or you can ensure this by overriding the GraphModel<NodeType,NodeKey>.MakeNodeKeyUnique method. The override (or the setting of the same-named delegate in GraphModel<NodeType,NodeKey>.Delegates) is required if nodes might be copied within the model.

If you want each node to keep a list of nodes for which there are links to those nodes coming out of this node data, you can use the ToKeys property, which is a list of node keys. If you want each node to keep a list of nodes from which there are links coming into this node data, you can use the FromKeys property, which is a list of node keys. You can use both lists at the same time.

If you want each node to keep a "reference" to the containing ("parent") group, you can use the SubGraphKey property. If you want subgraph data to keep a list of "references" to the contained ("children") nodes, you can use the MemberKeys property. You can use both properties at the same time.

Inheritance Hierarchy

System.Object
   Northwoods.GoXam.Model.GraphModelNodeData<NodeKey>

Requirements
See Also

Reference

GraphModelNodeData<NodeKey> Members
Northwoods.GoXam.Model Namespace

 

 


© Northwoods Software 2017. All Rights Reserved.

Send Feedback